FROM openjdk:17-slim

# 安装Python环境
RUN apt-get update && \
    apt-get install -y libaio1 && \
    apt-get install -y python3 python3-pip && \
    pip3 install --upgrade pip && \
    ln -s /usr/bin/python3 /usr/bin/python && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# 设置工作目录
WORKDIR /opt/backend/

RUN mkdir -p /var/tmp/sqlite && chmod 777 /var/tmp/sqlite
RUN mkdir -p /opt/backend/sqlite && chmod 77 /opt/backend/sqlite

# 拷贝应用程序包和启动脚本到容器中
COPY source-admin.jar start.sh /opt/backend/

RUN chmod +x start.sh \
    && chmod 755 /opt/backend/source-admin.jar

# 启动脚本
ENTRYPOINT ["java", "-Djava.io.tmpdir=/var/tmp/sqlite", "-jar", "/opt/backend/source-admin.jar"]
#CMD ["./start.sh"]